home *** CD-ROM | disk | FTP | other *** search
/ Aminet 25 / Aminet 25 (1998)(GTI - Schatztruhe)[!][Jun 1998].iso / Aminet / game / shoot / ADoom_src_1_2.lha / ADoom_src / hu_stuff.c < prev    next >
C/C++ Source or Header  |  1998-02-28  |  15KB  |  761 lines

  1. // Emacs style mode select   -*- C++ -*- 
  2. //-----------------------------------------------------------------------------
  3. //
  4. // $Id:$
  5. //
  6. // Copyright (C) 1993-1996 by id Software, Inc.
  7. //
  8. // This source is available for distribution and/or modification
  9. // only under the terms of the DOOM Source Code License as
  10. // published by id Software. All rights reserved.
  11. //
  12. // The source is distributed in the hope that it will be useful,
  13. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
  15. // for more details.
  16. //
  17. // $Log:$
  18. //
  19. // DESCRIPTION:  Heads-up displays
  20. //
  21. //-----------------------------------------------------------------------------
  22.  
  23. static const char
  24. rcsid[] = "$Id: hu_stuff.c,v 1.4 1997/02/03 16:47:52 b1 Exp $";
  25.  
  26. #include <ctype.h>
  27.  
  28. #include "doomdef.h"
  29.  
  30. #include "z_zone.h"
  31.  
  32. #include "m_swap.h"
  33.  
  34. #include "hu_stuff.h"
  35. #include "hu_lib.h"
  36. #include "w_wad.h"
  37.  
  38. #include "s_sound.h"
  39.  
  40. #include "doomstat.h"
  41.  
  42. // Data.
  43. #include "dstrings.h"
  44. #include "sounds.h"
  45.  
  46. //
  47. // Locally used constants, shortcuts.
  48. //
  49. #define HU_TITLE    (mapnames[(gameepisode-1)*9+gamemap-1])
  50. #define HU_TITLE2    (mapnames2[gamemap-1])
  51. #define HU_TITLEP    (mapnamesp[gamemap-1])
  52. #define HU_TITLET    (mapnamest[gamemap-1])
  53. #define HU_TITLEHEIGHT    1
  54. #define HU_TITLEX    0
  55. //#define HU_TITLEY    (167 - SWAPSHORT(hu_font[0]->height))
  56. #define HU_TITLEY    (SCREENHEIGHT-(200-(167 - SWAPSHORT(hu_font[0]->height))))
  57.  
  58. #define HU_INPUTTOGGLE    't'
  59. #define HU_INPUTX    HU_MSGX
  60. #define HU_INPUTY    (HU_MSGY + HU_MSGHEIGHT*(SWAPSHORT(hu_font[0]->height) +1))
  61. #define HU_INPUTWIDTH    64
  62. #define HU_INPUTHEIGHT    1
  63.  
  64.  
  65.  
  66. char*    chat_macros[] =
  67. {
  68.     HUSTR_CHATMACRO0,
  69.     HUSTR_CHATMACRO1,
  70.     HUSTR_CHATMACRO2,
  71.     HUSTR_CHATMACRO3,
  72.     HUSTR_CHATMACRO4,
  73.     HUSTR_CHATMACRO5,
  74.     HUSTR_CHATMACRO6,
  75.     HUSTR_CHATMACRO7,
  76.     HUSTR_CHATMACRO8,
  77.     HUSTR_CHATMACRO9
  78. };
  79.  
  80. char*    player_names[] =
  81. {
  82.     HUSTR_PLRGREEN,
  83.     HUSTR_PLRINDIGO,
  84.     HUSTR_PLRBROWN,
  85.     HUSTR_PLRRED
  86. };
  87.  
  88.  
  89. char            chat_char; // remove later.
  90. static player_t*    plr;
  91. patch_t*        hu_font[HU_FONTSIZE];
  92. static hu_textline_t    w_title;
  93. boolean            chat_on;
  94. static hu_itext_t    w_chat;
  95. static boolean        always_off = false;
  96. static char        chat_dest[MAXPLAYERS];
  97. static hu_itext_t w_inputbuffer[MAXPLAYERS];
  98.  
  99. static boolean        message_on;
  100. boolean            message_dontfuckwithme;
  101. static boolean        message_nottobefuckedwith;
  102.  
  103. static hu_stext_t    w_message;
  104. static int        message_counter;
  105.  
  106. extern int        showMessages;
  107. extern boolean        automapactive;
  108.  
  109. static boolean        headsupactive = false;
  110.  
  111. //
  112. // Builtin map names.
  113. // The actual names can be found in DStrings.h.
  114. //
  115.  
  116. char*    mapnames[] =    // DOOM shareware/registered/retail (Ultimate) names.
  117. {
  118.  
  119.     HUSTR_E1M1,
  120.     HUSTR_E1M2,
  121.     HUSTR_E1M3,
  122.     HUSTR_E1M4,
  123.     HUSTR_E1M5,
  124.     HUSTR_E1M6,
  125.     HUSTR_E1M7,
  126.     HUSTR_E1M8,
  127.     HUSTR_E1M9,
  128.  
  129.     HUSTR_E2M1,
  130.     HUSTR_E2M2,
  131.     HUSTR_E2M3,
  132.     HUSTR_E2M4,
  133.     HUSTR_E2M5,
  134.     HUSTR_E2M6,
  135.     HUSTR_E2M7,
  136.     HUSTR_E2M8,
  137.     HUSTR_E2M9,
  138.  
  139.     HUSTR_E3M1,
  140.     HUSTR_E3M2,
  141.     HUSTR_E3M3,
  142.     HUSTR_E3M4,
  143.     HUSTR_E3M5,
  144.     HUSTR_E3M6,
  145.     HUSTR_E3M7,
  146.     HUSTR_E3M8,
  147.     HUSTR_E3M9,
  148.  
  149.     HUSTR_E4M1,
  150.     HUSTR_E4M2,
  151.     HUSTR_E4M3,
  152.     HUSTR_E4M4,
  153.     HUSTR_E4M5,
  154.     HUSTR_E4M6,
  155.     HUSTR_E4M7,
  156.     HUSTR_E4M8,
  157.     HUSTR_E4M9,
  158.  
  159.     "NEWLEVEL",
  160.     "NEWLEVEL",
  161.     "NEWLEVEL",
  162.     "NEWLEVEL",
  163.     "NEWLEVEL",
  164.     "NEWLEVEL",
  165.     "NEWLEVEL",
  166.     "NEWLEVEL",
  167.     "NEWLEVEL"
  168. };
  169.  
  170. char*    mapnames2[] =    // DOOM 2 map names.
  171. {
  172.     HUSTR_1,
  173.     HUSTR_2,
  174.     HUSTR_3,
  175.     HUSTR_4,
  176.     HUSTR_5,
  177.     HUSTR_6,
  178.     HUSTR_7,
  179.     HUSTR_8,
  180.     HUSTR_9,
  181.     HUSTR_10,
  182.     HUSTR_11,
  183.     
  184.     HUSTR_12,
  185.     HUSTR_13,
  186.     HUSTR_14,
  187.     HUSTR_15,
  188.     HUSTR_16,
  189.     HUSTR_17,
  190.     HUSTR_18,
  191.     HUSTR_19,
  192.     HUSTR_20,
  193.     
  194.     HUSTR_21,
  195.     HUSTR_22,
  196.     HUSTR_23,
  197.     HUSTR_24,
  198.     HUSTR_25,
  199.     HUSTR_26,
  200.     HUSTR_27,
  201.     HUSTR_28,
  202.     HUSTR_29,
  203.     HUSTR_30,
  204.     HUSTR_31,
  205.     HUSTR_32
  206. };
  207.  
  208.  
  209. char*    mapnamesp[] =    // Plutonia WAD map names.
  210. {
  211.     PHUSTR_1,
  212.     PHUSTR_2,
  213.     PHUSTR_3,
  214.     PHUSTR_4,
  215.     PHUSTR_5,
  216.     PHUSTR_6,
  217.     PHUSTR_7,
  218.     PHUSTR_8,
  219.     PHUSTR_9,
  220.     PHUSTR_10,
  221.     PHUSTR_11,
  222.     
  223.     PHUSTR_12,
  224.     PHUSTR_13,
  225.     PHUSTR_14,
  226.     PHUSTR_15,
  227.     PHUSTR_16,
  228.     PHUSTR_17,
  229.     PHUSTR_18,
  230.     PHUSTR_19,
  231.     PHUSTR_20,
  232.     
  233.     PHUSTR_21,
  234.     PHUSTR_22,
  235.     PHUSTR_23,
  236.     PHUSTR_24,
  237.     PHUSTR_25,
  238.     PHUSTR_26,
  239.     PHUSTR_27,
  240.     PHUSTR_28,
  241.     PHUSTR_29,
  242.     PHUSTR_30,
  243.     PHUSTR_31,
  244.     PHUSTR_32
  245. };
  246.  
  247.  
  248. char *mapnamest[] =    // TNT WAD map names.
  249. {
  250.     THUSTR_1,
  251.     THUSTR_2,
  252.     THUSTR_3,
  253.     THUSTR_4,
  254.     THUSTR_5,
  255.     THUSTR_6,
  256.     THUSTR_7,
  257.     THUSTR_8,
  258.     THUSTR_9,
  259.     THUSTR_10,
  260.     THUSTR_11,
  261.     
  262.     THUSTR_12,
  263.     THUSTR_13,
  264.     THUSTR_14,
  265.     THUSTR_15,
  266.     THUSTR_16,
  267.     THUSTR_17,
  268.     THUSTR_18,
  269.     THUSTR_19,
  270.     THUSTR_20,
  271.     
  272.     THUSTR_21,
  273.     THUSTR_22,
  274.     THUSTR_23,
  275.     THUSTR_24,
  276.     THUSTR_25,
  277.     THUSTR_26,
  278.     THUSTR_27,
  279.     THUSTR_28,
  280.     THUSTR_29,
  281.     THUSTR_30,
  282.     THUSTR_31,
  283.     THUSTR_32
  284. };
  285.  
  286.  
  287. const char*    shiftxform;
  288.  
  289. const char french_shiftxform[] =
  290. {
  291.     0,
  292.     1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
  293.     11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
  294.     21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
  295.     31,
  296.     ' ', '!', '"', '#', '$', '%', '&',
  297.     '"', // shift-'
  298.     '(', ')', '*', '+',
  299.     '?', // shift-,
  300.     '_', // shift--
  301.     '>', // shift-.
  302.     '?', // shift-/
  303.     '0', // shift-0
  304.     '1', // shift-1
  305.     '2', // shift-2
  306.     '3', // shift-3
  307.     '4', // shift-4
  308.     '5', // shift-5
  309.     '6', // shift-6
  310.     '7', // shift-7
  311.     '8', // shift-8
  312.     '9', // shift-9
  313.     '/',
  314.     '.', // shift-;
  315.     '<',
  316.     '+', // shift-=
  317.     '>', '?', '@',
  318.     'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
  319.     'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
  320.     '[', // shift-[
  321.     '!', // shift-backslash - OH MY GOD DOES WATCOM SUCK
  322.     ']', // shift-]
  323.     '"', '_',
  324.     '\'', // shift-`
  325.     'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
  326.     'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
  327.     '{', '|', '}', '~', 127
  328.  
  329. };
  330.  
  331. const char english_shiftxform[] =
  332. {
  333.  
  334.     0,
  335.     1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
  336.     11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
  337.     21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
  338.     31,
  339.     ' ', '!', '"', '#', '$', '%', '&',
  340.     '"', // shift-'
  341.     '(', ')', '*', '+',
  342.     '<', // shift-,
  343.     '_', // shift--
  344.     '>', // shift-.
  345.     '?', // shift-/
  346.     ')', // shift-0
  347.     '!', // shift-1
  348.     '@', // shift-2
  349.     '#', // shift-3
  350.     '$', // shift-4
  351.     '%', // shift-5
  352.     '^', // shift-6
  353.     '&', // shift-7
  354.     '*', // shift-8
  355.     '(', // shift-9
  356.     ':',
  357.     ':', // shift-;
  358.     '<',
  359.     '+', // shift-=
  360.     '>', '?', '@',
  361.     'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
  362.     'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
  363.     '[', // shift-[
  364.     '!', // shift-backslash - OH MY GOD DOES WATCOM SUCK
  365.     ']', // shift-]
  366.     '"', '_',
  367.     '\'', // shift-`
  368.     'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
  369.     'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
  370.     '{', '|', '}', '~', 127
  371. };
  372.  
  373. char frenchKeyMap[128]=
  374. {
  375.     0,
  376.     1,2,3,4,5,6,7,8,9,10,
  377.     11,12,13,14,15,16,17,18,19,20,
  378.     21,22,23,24,25,26,27,28,29,30,
  379.     31,
  380.     ' ','!','"','#','$','%','&','%','(',')','*','+',';','-',':','!',
  381.     '0','1','2','3','4','5','6','7','8','9',':','M','<','=','>','?',
  382.     '@','Q','B','C','D','E','F','G','H','I','J','K','L',',','N','O',
  383.     'P','A','R','S','T','U','V','Z','X','Y','W','^','\\','$','^','_',
  384.     '@','Q','B','C','D','E','F','G','H','I','J','K','L',',','N','O',
  385.     'P','A','R','S','T','U','V','Z','X','Y','W','^','\\','$','^',127
  386. };
  387.  
  388. char ForeignTranslation(unsigned char ch)
  389. {
  390.     return ch < 128 ? frenchKeyMap[ch] : ch;
  391. }
  392.  
  393. void HU_Init(void)
  394. {
  395.  
  396.     int        i;
  397.     int        j;
  398.     char    buffer[9];
  399.  
  400.     if (language==french)
  401.     shiftxform = french_shiftxform;
  402.     else
  403.     shiftxform = english_shiftxform;
  404.  
  405.     // load the heads-up font
  406.     j = HU_FONTSTART;
  407.     for (i=0;i<HU_FONTSIZE;i++)
  408.     {
  409.     sprintf(buffer, "STCFN%.3d", j++);
  410.     hu_font[i] = (patch_t *) W_CacheLumpName(buffer, PU_STATIC);
  411.     }
  412.  
  413. }
  414.  
  415. void HU_Stop(void)
  416. {
  417.     headsupactive = false;
  418. }
  419.  
  420. void HU_Start(void)
  421. {
  422.  
  423.     int        i;
  424.     char*    s;
  425.  
  426.     if (headsupactive)
  427.     HU_Stop();
  428.  
  429.     plr = &players[consoleplayer];
  430.     message_on = false;
  431.     message_dontfuckwithme = false;
  432.     message_nottobefuckedwith = false;
  433.     chat_on = false;
  434.  
  435.     // create the message widget
  436.     HUlib_initSText(&w_message,
  437.             HU_MSGX, HU_MSGY, HU_MSGHEIGHT,
  438.             hu_font,
  439.             HU_FONTSTART, &message_on);
  440.  
  441.     // create the map title widget
  442.     HUlib_initTextLine(&w_title,
  443.                HU_TITLEX, HU_TITLEY,
  444.                hu_font,
  445.                HU_FONTSTART);
  446.     
  447.     switch ( gamemode )
  448.     {
  449.       case shareware:
  450.       case registered:
  451.       case retail:
  452.     s = HU_TITLE;
  453.     break;
  454.  
  455. /* FIXME
  456.       case pack_plut:
  457.     s = HU_TITLEP;
  458.     break;
  459.       case pack_tnt:
  460.     s = HU_TITLET;
  461.     break;
  462. */
  463.     
  464.       case commercial:
  465.       default:
  466.      s = HU_TITLE2;
  467.      break;
  468.     }
  469.     
  470.     while (*s)
  471.     HUlib_addCharToTextLine(&w_title, *(s++));
  472.  
  473.     // create the chat widget
  474.     HUlib_initIText(&w_chat,
  475.             HU_INPUTX, HU_INPUTY,
  476.             hu_font,
  477.             HU_FONTSTART, &chat_on);
  478.  
  479.     // create the inputbuffer widgets
  480.     for (i=0 ; i<MAXPLAYERS ; i++)
  481.     HUlib_initIText(&w_inputbuffer[i], 0, 0, 0, 0, &always_off);
  482.  
  483.     headsupactive = true;
  484.  
  485. }
  486.  
  487. void HU_Drawer(void)
  488. {
  489.  
  490.     HUlib_drawSText(&w_message);
  491.     HUlib_drawIText(&w_chat);
  492.     if (automapactive)
  493.     HUlib_drawTextLine(&w_title, false);
  494.  
  495. }
  496.  
  497. void HU_Erase(void)
  498. {
  499.  
  500.     HUlib_eraseSText(&w_message);
  501.     HUlib_eraseIText(&w_chat);
  502.     HUlib_eraseTextLine(&w_title);
  503.  
  504. }
  505.  
  506. void HU_Ticker(void)
  507. {
  508.  
  509.     int i, rc;
  510.     char c;
  511.  
  512.     // tick down message counter if message is up
  513.     if (message_counter && !--message_counter)
  514.     {
  515.     message_on = false;
  516.     message_nottobefuckedwith = false;
  517.     }
  518.  
  519.     if (showMessages || message_dontfuckwithme)
  520.     {
  521.  
  522.     // display message if necessary
  523.     if ((plr->message && !message_nottobefuckedwith)
  524.         || (plr->message && message_dontfuckwithme))
  525.     {
  526.         HUlib_addMessageToSText(&w_message, 0, plr->message);
  527.         plr->message = 0;
  528.         message_on = true;
  529.         message_counter = HU_MSGTIMEOUT;
  530.         message_nottobefuckedwith = message_dontfuckwithme;
  531.         message_dontfuckwithme = 0;
  532.     }
  533.  
  534.     } // else message_on = false;
  535.  
  536.     // check for incoming chat characters
  537.     if (netgame)
  538.     {
  539.     for (i=0 ; i<MAXPLAYERS; i++)
  540.     {
  541.         if (!playeringame[i])
  542.         continue;
  543.         if (i != consoleplayer
  544.         && (c = players[i].cmd.chatchar))
  545.         {
  546.         if (c <= HU_BROADCAST)
  547.             chat_dest[i] = c;
  548.         else
  549.         {
  550.             if (c >= 'a' && c <= 'z')
  551.             c = (char) shiftxform[(unsigned char) c];
  552.             rc = HUlib_keyInIText(&w_inputbuffer[i], c);
  553.             if (rc && c == KEY_ENTER)
  554.             {
  555.             if (w_inputbuffer[i].l.len
  556.                 && (chat_dest[i] == consoleplayer+1
  557.                 || chat_dest[i] == HU_BROADCAST))
  558.             {
  559.                 HUlib_addMessageToSText(&w_message,
  560.                             player_names[i],
  561.                             w_inputbuffer[i].l.l);
  562.                 
  563.                 message_nottobefuckedwith = true;
  564.                 message_on = true;
  565.                 message_counter = HU_MSGTIMEOUT;
  566.                 if ( gamemode == commercial )
  567.                   S_StartSound(0, sfx_radio);
  568.                 else
  569.                   S_StartSound(0, sfx_tink);
  570.             }
  571.             HUlib_resetIText(&w_inputbuffer[i]);
  572.             }
  573.         }
  574.         players[i].cmd.chatchar = 0;
  575.         }
  576.     }
  577.     }
  578.  
  579. }
  580.  
  581. #define QUEUESIZE        128
  582.  
  583. static char    chatchars[QUEUESIZE];
  584. static int    head = 0;
  585. static int    tail = 0;
  586.  
  587.  
  588. void HU_queueChatChar(char c)
  589. {
  590.     if (((head + 1) & (QUEUESIZE-1)) == tail)
  591.     {
  592.     plr->message = HUSTR_MSGU;
  593.     }
  594.     else
  595.     {
  596.     chatchars[head] = c;
  597.     head = (head + 1) & (QUEUESIZE-1);
  598.     }
  599. }
  600.  
  601. char HU_dequeueChatChar(void)
  602. {
  603.     char c;
  604.  
  605.     if (head != tail)
  606.     {
  607.     c = chatchars[tail];
  608.     tail = (tail + 1) & (QUEUESIZE-1);
  609.     }
  610.     else
  611.     {
  612.     c = 0;
  613.     }
  614.  
  615.     return c;
  616. }
  617.  
  618. boolean HU_Responder(event_t *ev)
  619. {
  620.  
  621.     static char        lastmessage[HU_MAXLINELENGTH+1];
  622.     char*        macromessage;
  623.     boolean        eatkey = false;
  624.     static boolean    shiftdown = false;
  625.     static boolean    altdown = false;
  626.     unsigned char     c;
  627.     int            i;
  628.     int            numplayers;
  629.     
  630.     static char        destination_keys[MAXPLAYERS] =
  631.     {
  632.     HUSTR_KEYGREEN,
  633.     HUSTR_KEYINDIGO,
  634.     HUSTR_KEYBROWN,
  635.     HUSTR_KEYRED
  636.     };
  637.     
  638.     static int        num_nobrainers = 0;
  639.  
  640.     numplayers = 0;
  641.     for (i=0 ; i<MAXPLAYERS ; i++)
  642.     numplayers += playeringame[i];
  643.  
  644.     if (ev->data1 == KEY_RSHIFT)
  645.     {
  646.     shiftdown = ev->type == ev_keydown;
  647.     return false;
  648.     }
  649.     else if (ev->data1 == KEY_RALT || ev->data1 == KEY_LALT)
  650.     {
  651.     altdown = ev->type == ev_keydown;
  652.     return false;
  653.     }
  654.  
  655.     if (ev->type != ev_keydown)
  656.     return false;
  657.  
  658.     if (!chat_on)
  659.     {
  660.     if (ev->data1 == HU_MSGREFRESH)
  661.     {
  662.         message_on = true;
  663.         message_counter = HU_MSGTIMEOUT;
  664.         eatkey = true;
  665.     }
  666.     else if (netgame && ev->data1 == HU_INPUTTOGGLE)
  667.     {
  668.         eatkey = chat_on = true;
  669.         HUlib_resetIText(&w_chat);
  670.         HU_queueChatChar(HU_BROADCAST);
  671.     }
  672.     else if (netgame && numplayers > 2)
  673.     {
  674.         for (i=0; i<MAXPLAYERS ; i++)
  675.         {
  676.         if (ev->data1 == destination_keys[i])
  677.         {
  678.             if (playeringame[i] && i!=consoleplayer)
  679.             {
  680.             eatkey = chat_on = true;
  681.             HUlib_resetIText(&w_chat);
  682.             HU_queueChatChar(i+1);
  683.             break;
  684.             }
  685.             else if (i == consoleplayer)
  686.             {
  687.             num_nobrainers++;
  688.             if (num_nobrainers < 3)
  689.                 plr->message = HUSTR_TALKTOSELF1;
  690.             else if (num_nobrainers < 6)
  691.                 plr->message = HUSTR_TALKTOSELF2;
  692.             else if (num_nobrainers < 9)
  693.                 plr->message = HUSTR_TALKTOSELF3;
  694.             else if (num_nobrainers < 32)
  695.                 plr->message = HUSTR_TALKTOSELF4;
  696.             else
  697.                 plr->message = HUSTR_TALKTOSELF5;
  698.             }
  699.         }
  700.         }
  701.     }
  702.     }
  703.     else
  704.     {
  705.     c = ev->data1;
  706.     // send a macro
  707.     if (altdown)
  708.     {
  709.         c = c - '0';
  710.         if (c > 9)
  711.         return false;
  712.         // fprintf(stderr, "got here\n");
  713.         macromessage = chat_macros[c];
  714.         
  715.         // kill last message with a '\n'
  716.         HU_queueChatChar(KEY_ENTER); // DEBUG!!!
  717.         
  718.         // send the macro message
  719.         while (*macromessage)
  720.         HU_queueChatChar(*macromessage++);
  721.         HU_queueChatChar(KEY_ENTER);
  722.         
  723.         // leave chat mode and notify that it was sent
  724.         chat_on = false;
  725.         strcpy(lastmessage, chat_macros[c]);
  726.         plr->message = lastmessage;
  727.         eatkey = true;
  728.     }
  729.     else
  730.     {
  731.         if (language==french)
  732.         c = ForeignTranslation(c);
  733.         if (shiftdown || (c >= 'a' && c <= 'z'))
  734.         c = shiftxform[c];
  735.         eatkey = HUlib_keyInIText(&w_chat, c);
  736.         if (eatkey)
  737.         {
  738.         // static unsigned char buf[20]; // DEBUG
  739.         HU_queueChatChar(c);
  740.         
  741.         // sprintf(buf, "KEY: %d => %d", ev->data1, c);
  742.         //      plr->message = buf;
  743.         }
  744.         if (c == KEY_ENTER)
  745.         {
  746.         chat_on = false;
  747.         if (w_chat.l.len)
  748.         {
  749.             strcpy(lastmessage, w_chat.l.l);
  750.             plr->message = lastmessage;
  751.         }
  752.         }
  753.         else if (c == KEY_ESCAPE)
  754.         chat_on = false;
  755.     }
  756.     }
  757.  
  758.     return eatkey;
  759.  
  760. }
  761.